﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using Microsoft.WindowsMobile.PocketOutlook;
using Microsoft.WindowsMobile.PocketOutlook.MessageInterception;

namespace SMSCoordinate
{
    class SMSManager
    {
        private MessageInterceptor msgInterceptor = null;

        public static void SendSMS(string number, string body)
        {
            SmsMessage smsMessage = new SmsMessage();
            Recipient re = new Recipient(number);
            smsMessage.To.Add(re);
            smsMessage.Body = body;
            try
            {
                smsMessage.Send();
            }
            catch (Exception ex)
            {
                Console.Out.Write(ex.Message);
            }
        }

        public SMSManager(MessageInterceptorEventHandler messageInterceptorEvent, MessageCondition condition)
        {
            msgInterceptor = new MessageInterceptor();
            msgInterceptor.InterceptionAction = InterceptionAction.NotifyAndDelete;
            msgInterceptor.MessageCondition = condition;
            msgInterceptor.MessageReceived += messageInterceptorEvent;
                        
        }

    }
}
